package com.ujs.statistics.controller;


import com.ujs.commonutils.constant.R;
import com.ujs.statistics.entity.vo.EchartsVo;
import com.ujs.statistics.service.DailyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2023-09-04
 */
@RestController
@RequestMapping("/edustatistics/daily")
@Api("统计数据api")
public class DailyController {
    @Autowired
    private DailyService dailyService;

    @ApiOperation("统计某一天的注册人数，生成统计数据")
    @GetMapping("/registerCount/{day}")
    public R registerCount(@PathVariable("day") String day){
        dailyService.registerCount(day);
        return R.ok();
    }

    @ApiOperation("Echarts的显示数据")
    @PostMapping("/getData")
    public R getData(@RequestBody EchartsVo echartsVo) {
        Map<String, Object> map = dailyService.getData(echartsVo);
        System.out.println(map);
        return R.ok().data(map);
    }
}

